package com.onehouse.infrastructure.repository.checkIn;

import com.onehouse.domain.checkIn.adapter.repository.ICheckInOrderRepository;
import com.onehouse.domain.checkIn.model.entity.CheckInRooms;
import com.onehouse.infrastructure.dao.CheckInRoomsDao;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Repository;

@Repository
public class CheckInOrderRepository implements ICheckInOrderRepository {
    @Resource
    private CheckInRoomsDao checkInRoomsDao;

    @Override
    public void doSaveOrder(CheckInRooms checkInRooms) {
        com.onehouse.infrastructure.dao.po.CheckInRooms po = new com.onehouse.infrastructure.dao.po.CheckInRooms();
        po.setCheckInRoomsId(checkInRooms.getCheckInRoomsId());
        po.setCheckInStatus(checkInRooms.getCheckInStatus().name());
        po.setTotalAmount(checkInRooms.getTotalAmount());
        checkInRoomsDao.insert(po);
    }

    @Override
    public void updateOrder(CheckInRooms checkInRooms) {
        com.onehouse.infrastructure.dao.po.CheckInRooms po = new com.onehouse.infrastructure.dao.po.CheckInRooms();
        po.setCheckInRoomsId(checkInRooms.getCheckInRoomsId());
        po.setCheckInStatus(checkInRooms.getCheckInStatus().name());
        po.setTotalAmount(checkInRooms.getTotalAmount());
        checkInRoomsDao.update(po);
    }
}
